/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package org.restorator.dao.implement;

import java.sql.PreparedStatement;
import java.sql.SQLException;
import java.util.List;
import org.restorator.dao.base.CategoryDao;
import org.restorator.dao.implement.engin.CategoryMapper;
import org.restorator.dao.implement.engin.ItemRowMapper;
import org.restorator.dao.jdbc.AbstractJdbsTemplate;
import org.restorator.dao.jdbc.Enricher;
import org.restorator.dao.jdbc.PreparedSetter;
import org.restorator.dao.jdbc.SimpleResultSetExtractor;
import org.restorator.entity.Category;
import org.restorator.entity.Item;
import org.restorator.exception.DataStoreException;

/**
 *
 * @author Mama
 */
public class CategoryDaoImpl extends AbstractJdbsTemplate<Category, Integer> implements CategoryDao{

    private static final String SQL_SELECT_GET_CAT_BY_NAME = "SELECT CATHEGORY_ID FROM CATHEGORY WHERE CATHEGORY_NAME = ?";
    
    @Override
    public Category getCatByName(final String name) throws DataStoreException{
        return executeParameter(SQL_SELECT_GET_CAT_BY_NAME,
                new SimpleResultSetExtractor(new CategoryMapper()),
                Enricher.NULL,
                new PreparedSetter() {
                    @Override
                    public void setParameters(PreparedStatement ps) throws SQLException {
                        ps.setString(1, name);
                    }
                });
    }

    @Override
    public Category get(Integer id) throws DataStoreException {
        throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
    }

    @Override
    public Category update(Category persistElement) throws DataStoreException {
        throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
    }

    @Override
    public void delete(Category deleted) throws DataStoreException {
        throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
    }

    @Override
    public long count() {
        throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
    }

    @Override
    public Integer save(Category persist, Object... addParams) throws DataStoreException {
        throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
    }

    @Override
    public List<Category> getAll() throws DataStoreException {
        throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
    }

    @Override
    public boolean exist(Integer id) {
        throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
    }
    
}
